/*****************************************************************************
 * Product: 数据同步解决方案                                                    
 * Copyright (C) 2010-2011  瑞科软件. All Rights Reserved.                                                                       *
 * 改程序是开源的，您可以修改源代码，做二次开发，定制您自己的同步程序                     
 * 您可以通过我们的网站了解详细信息，包括安装与使用指南，  http://www.ruike.org         
 * 																		      			
 *****************************************************************************/
package com.mk.code.engine.mean.method;

/**
 * 可选的解析模式[]
 * 
 * @功能 
 * @author 张华
 * @date Jul 24, 2009
 * @version 1.0  Jul 24, 2009 9:43:00 PM
 */
public  class SingleOptionMethod extends AbstractMethod {
	private String[] words;

	private int repeatFrom = -1;
	private int repeatEnd = -1;
	
	private int currentRepeatIndex;
	
	public SingleOptionMethod(AbstractMethod parent) {
		super(parent);
	}
	
	public String[] getValue() {
		return words;
	}

	
	public void parse() {	
		parseSub();
	}
	
	public boolean parseSub() {
		currentRepeatIndex++;
		int offIndex = this.parent.offsetIndex;
		this.index = offIndex;
		this.offsetIndex = 0;
		String [] wds = this.parent.getValue();
		int i = 0;
		while(!wds[this.index+i].equals("]")) {
			i++;
		}
		words = new String[i-1];
		System.arraycopy(wds, this.index+1, words, 0, words.length);
		this.parent.offsetIndex += (i+1);
		return true;
	}
	
	public  boolean process() {
		
		return true;
	}


}
